package de.szut.bomberman.gui.main;

import java.awt.Color;
import java.awt.Font;

import javax.swing.JLayeredPane;

import de.szut.bomberman.gui.options.OptionKeys;
import de.szut.bomberman.main.Controller;
import de.szut.gui.language.Languages;

public class GUIController {
	public static final Color COMPONENTBACKGROUNDCOLOR = Color.BLACK;
	public static final Color COMPONENTFOREGROUNDCOLOR = Color.CYAN;
	public static final Font COMPONENTFONT = new Font("Tahoma", Font.PLAIN, 11);
	
	private MainFrame mainFrame;
	private Languages languages;
	private JLayeredPane currentPanel;
	
	public MainFrame getMainFrame() {
		return mainFrame;
	}

	public void setMainFrame(MainFrame mainFrame) {
		this.mainFrame = mainFrame;
	}

	public JLayeredPane getCurrentPanel() {
		return currentPanel;
	}

	public void setCurrentPanel(JLayeredPane currentPanel) {
		this.currentPanel = currentPanel;
	}

	public Languages getLanguages() {
		return languages;
	}

	public void setLanguages(Languages languages) {
		this.languages = languages;
	}

	/**
	 * Starts the GUI Controller
	 */
	public void startGUIController() {
		// TODO: Start up the GUI ...
		setLanguages(new Languages());
		languages.addLanguage("German");
		languages.setCurrentLanguage(Controller.getInstance().getOptions().getOptionValue(OptionKeys.LANGUAGE));
		mainFrame = new MainFrame();
		mainFrame.startFrame();
		setCurrentPanel((JLayeredPane) mainFrame.getContentPane());
	}
	
	/**
	 * Switches the panel on the MainFrame
	 * @param newPanel: Panel to switch to
	 */
	public void switchPanel(JLayeredPane newPanel) {
		mainFrame.remove(currentPanel);
		currentPanel = newPanel;
		mainFrame.setContentPane(currentPanel);
		mainFrame.repaint();
		mainFrame.revalidate();
		Controller.getInstance().setGameWon(false);
	}
}
